<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TypeDAO
 *
 * @author Hoan Vu
 */
class TypeDAO {
    public function getType($id) {
        $table = new Type();
        $row = $table->fetchRow('id='.$id);
        return $row;
    }

    public function getTypeList() {
       $table = new Type();
       $row = $table->fetchAll($table->select()->where('status = ?',1));
       return $row;
    }

    public function addType($data) {
        $types = new Type();
        $types->insert($data);
    }

    public function editType($data) {
        $table = new Type();
        $where = $table->getAdapter()->quoteInto('id = ?', $data['id']);
        $table->update($data, $where);
    }

    public function deleteType($id) {
        $table = new Type();
        $data = array("status" => 0);
        $where = $table->getAdapter()->quoteInto('id = ?', $id);
        $table->update($data, $where);
    }
}
?>
